<?php
$lang = "tr";
$diller = ["tr","en"];

session_start();

if(isset($_GET["degistir"]) && in_array($_GET["degistir"],$diller)) {
    $lang = $_GET["degistir"];
//  setcookie ( 'dil', $lang, time() + 60*60*24*30, '/', 'mls.akdeniz.edu.tr');
	$_SESSION['dil'] = $lang;
    if (isset($_SERVER["HTTP_REFERER"])) {
        header("Location: " . $_SERVER["HTTP_REFERER"]);
    } else {
		header("Location: index.php");
	}
} else {
	$lang = (isset($_SESSION['dil']) && in_array($_SESSION['dil'],$diller) ? $_SESSION['dil'] : $lang);
	require_once('yazilar/'.$lang.'.php');
}

?>